﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FlexControls
{
    public partial class frmListView : Form
    {
        public frmListView()
        {
            InitializeComponent();
            
        }
        public string strSelectedItemCode = "", strSelectedItemData="";
        private void frmListView_Shown(object sender, EventArgs e)
        {

        }

        internal string LoadForm(string strSQL, ADODB.Connection Conn)
        {
            try
            {
                fcListView.LoadData(strSQL, Conn);
               this.ShowDialog();
                return fcListView.strSelectItemCode;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Listview loadform \n" + Convert.ToString(ex));
                return "";
            }
        }


        private void frmListView_KeyDown(object sender, KeyEventArgs e)
        {

            if (e.KeyCode.Equals(System.Windows.Forms.Keys.Escape) || e.KeyCode.Equals(System.Windows.Forms.Keys.Enter))
            {

                strSelectedItemCode = fcListView.strSelectItemCode;
                strSelectedItemData = fcListView.strSelectItemData;
                this.Visible = false;
            }
        }

        private void fcListView_DoubleClick(object sender, EventArgs e)
        {
            strSelectedItemCode = fcListView.strSelectItemCode;
            strSelectedItemData = fcListView.strSelectItemData;
            this.Visible = false;

        }


    }
}
